<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'area-show.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
			<%@include file="/WEB-INF/common/hplus-css.jsp" %>
			<link rel="shortcut icon" href="${path}/favicon.ico" rel="stylesheet">
			<link href="${path}/assets/hplus/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
			<link href="${path}/assets/hplus/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
			<link href="${path}/assets/hplus/css/animate.css" rel="stylesheet">
			<link href="${path}/assets/hplus/css/style.css?v=4.1.0" rel="stylesheet">
			<link href="${path}/assets/hplus/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
			<link href="${path}/assets/hplus/css/plugins/jsTree/style.min.css" rel="stylesheet">
			<link href="${path}/assets/hplus/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">

  </head>
  
  <body>
    
	<!-- 权限分配模框-->

	<div class="modal fade" id="setAuthority">

		<div class="modal-dialog">

			<div class="modal-content message_align">

				<div class="modal-header">

					<button type="button" class="close" data-dismiss="modal"

						aria-label="Close">

						<span aria-hidden="true">×</span>

					</button>

					<h4 class="modal-title">权限分配</h4>

				</div>

				<div class="modal-body">

					<div id= "jstree">

					

					</div>

				</div>

				<div class="modal-footer">

					<input type="hidden" id="url" />

					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>

					<a onclick="authorityConfirm()"   class="btn btn-success"

						data-dismiss="modal">确定</a>

				</div>

			</div>

			<!-- /.modal-content -->

		</div>

		<!-- /.modal-dialog -->

	</div>
    
  </body>
  			<%@include file="/WEB-INF/common/hplus-js.jsp"%>
			<!-- Peity -->
			<script src="${path}/assets/hplus/js/plugins/peity/jquery.peity.min.js"></script>
			<script src="${path}/assets/hplus/js/content.js"></script>
			<script src="${path}/assets/hplus/js/plugins/jsTree/jstree.min.js"></script>
			<!-- jqGrid -->
			<script src="${path}/assets/hplus/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
			<script src="${path}/assets/hplus/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
			<script type="text/javascript">
				
//权限分配

		$('#authority').click(function() {

			 $("#jstree").jstree({

		            "core" : {

		                "themes" : {

		                    "responsive": false

		                }, 

		                // so that create works

		                "check_callback" : true,

		                'data' : function (obj, callback) {

		                    var jsonstr="[]";

		                    var jsonarray = eval('('+jsonstr+')');

		                    $.ajax({

		                        type: "GET",

		                        url:"${path}/area/querylist",

		                        dataType:"json",

		                        async: false,

		                        success:function(result) {

		                            var arrays= result;

		                            for(var i=0 ; i<arrays.length; i++){

		                            	console.log(arrays[i])

		                                var arr = {

		                                        "id":arrays[i].id,

		                                        "parent":arrays[i].parentId=="root"?"#":arrays[i].parentId,

		                                        "text":arrays[i].name

		                                }

		                                jsonarray.push(arr);

		                            }

		                        }

 

		                    });

		                    callback.call(this, jsonarray);

		                }

		            },

		            "types" : {

		                "default" : {

		                	"icon" : "glyphicon glyphicon-flash"

		                },

		                "file" : {

		                	 "icon" : "glyphicon glyphicon-ok"  

		                }

		            },

		            "state" : { "key" : "demo2" },

		            "plugins" : [ "dnd", "state", "types","checkbox","wholerow" ]

		        });

				$('#setAuthority').modal();

		});
				
			</script>
</html>
